<%--
 * list.jsp
 *
 * Copyright (C) 2013 Universidad de Sevilla
 * 
 * The use of this project is hereby constrained to the conditions of the 
 * TDG Licence, a copy of which you may download from 
 * http://www.tdg-seville.info/License.html
 --%>

<%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>

<%@taglib prefix="jstl"	uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="security" uri="http://www.springframework.org/security/tags"%>
<%@taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@taglib prefix="acme" tagdir="/WEB-INF/tags" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>


<display:table pagesize="5" class="displaytag" 
name="events" requestURI="${URI}" id="row">
	
	<fmt:formatDate var="startMom" value="${row.startMoment}" pattern="yyyy/MM/dd HH:mm"/>
	<fmt:formatDate var="finishMom" value="${row.finishMoment}" pattern="yyyy/MM/dd HH:mm"/>
	
	<!-- Attributes -->
	
	<spring:message code="project.title" var="titleHeader" />
	<display:column property="title" title="${titleHeader}" sortable="true" />
	
	<spring:message code="project.creationMoment" var="creationMomentHeader" />
	<display:column property="creationMoment" title="${creationMomentHeader}" sortable="true"/>
	
	<spring:message code="project.startMoment" var="startMomentHeader" />
	<display:column property="startMoment" title="${startMomentHeader}" sortable="false" />
	
	<spring:message code="project.finishMoment" var="finishMomentHeader" />
	<display:column property="finishMoment" title="${finishMomentHeader}" sortable="false" />
	
	<jstl:if test="${row.state == \"Recruiting\"}">
		<spring:message code="project.recruiting" var="recruitingHeader" />
	 	<display:column title="${recruitingHeader}" sortable="true">
			<spring:message code="project.affirmative"/>
		</display:column>
	</jstl:if>
	<jstl:if test="${row.state != \"Recruiting\"}">
		<spring:message code="project.recruiting" var="recruitingHeader" />
	 	<display:column title="${recruitingHeader}" sortable="true">
			<spring:message code="project.negative"/>
		</display:column>
	</jstl:if>
	
	
	<jstl:if test="${URI == \"/project/list.do\" || URI == \"/project/user/listAvailable.do\"}">
	<security:authorize access="hasRole('USER')">
		<spring:message code="project.registration" var="registrationHeader" />
	 	<display:column title="${registrationHeader}" sortable="false">
		<jstl:if test="${row.state == \"Recruiting\"}">
		<spring:message code="project.registration" var="registration"/>
			<input type="button" name="registration"
				value="${registration}"
				onclick="javascript: window.location.replace('registration/edit.do?projectId=${row.id}')" />
		</jstl:if>
		</display:column>
	</security:authorize>
	</jstl:if>
	
	
	<security:authorize access="hasRole('USER')">
	<div>
	<a href="project/user/create.do"> 
		<spring:message	code="project.create" />
	</a>
	</div>
	</security:authorize>
</display:table>